package com.lagou.homework3.no4;

import java.util.List;

/**
 * 添加学生信息
 */
public class AddStudent {

    public static List add(List list, Student student){
        //判断学号是否重复
        for(int i=0;i<list.size();i++){
            Student stu = (Student) list.get(i);
            if(stu.getId()==student.getId()){
                System.out.println("当前学号重复请重新输入");
                return list;
            }
        }
        list.add(student);
        return list;
    }
}
